package com.study.leetcode;

import java.util.ArrayList;
import java.util.List;

public class Solution_1023 {
    public static List<Boolean> camelMatch(String[] queries, String pattern) {
        List<Boolean> matchs = new ArrayList<>();
        int idxP;
        int idxQ;
        char c;
        for (String query : queries) {
            idxP = 0;
            for (idxQ = 0; idxQ < query.length(); idxQ++) {
                c = query.charAt(idxQ);
                if (idxP < pattern.length() && c == pattern.charAt(idxP)) {
                    idxP++;
                } else if ('A' <= c && c <= 'Z') {
                    break;
                }
            }
            matchs.add(idxP == pattern.length() && idxQ == query.length());
        }
        return matchs;
    }

    public static void main(String[] args) {
        String[] queries = {"FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"};
        String pattern = "FB";
        List<Boolean> booleans = camelMatch(queries, pattern);
        System.out.println("booleans = " + booleans);
    }
}
